<?php
/**
 * Created by PhpStorm.
 * User: 李迪
 * Date: 2019/2/23
 * Time: 10:00
 */
namespace App\Http\Controllers\Homepage;

use App\Http\Controllers\BaseApiController;
use App\Services\Homepage\SearchService;

class SearchController extends BaseApiController
{
    private $SearchService;

    public function __construct( SearchService $SearchService )
    {
        parent::__construct();
        $this->SearchService = $SearchService;
    }

    //搜索的方法
    public function getSearch()
    {
        
    }

    //获取搜索历史最新的五条数据
    public function getHistory()
    {
        $list = $this->SearchService->getList();
        return json_encode($list);
    }

    //获取搜索次数最高的五条数据
    public function maxInfo()
    {
        $list = $this->SearchService->getMax();
        return json_encode($list);
    }
}